import React, { Component } from 'react';
import { connect } from 'react-redux';
import { saveLoginUser, saveLoginPerm } from '../../../store/store1/action';
import FChild1 from './FChild1'; 
import FChild2 from './FChild2'; 

class FParent extends Component {
	state = {
		msg1: 'h111',
		msg2: 'h222',
	}
	pFn = () => {
		console.log('FParent', 'pFn');
		this.props.saveLoginUser('orderSum22', 'orderSum');
	}
	// 渲染函数
    render() {
    	return (
			<div>
			    <div onClick={this.pFn}>FParent:点击事件:{this.props.loginUser.orderSum}</div>
				<FChild1 fntest={this.pFn} ms1={this.state.msg1} ms2={this.state.msg2}></FChild1>
				<FChild2 fntest={this.pFn} ms1={this.state.msg1} ms2={this.state.msg2}></FChild2>
			</div>
		);
    }
};

export default connect(state => ({
	loginUser: state.loginUser,
	loginPerm: state.loginPerm,
}), {
	saveLoginUser, 
	saveLoginPerm,
})(FParent);
